package br.unicentro.lynx.view;

import java.awt.Dimension;
import java.awt.Graphics;

import javax.swing.ImageIcon;
import javax.swing.JWindow;

public class SplashScreen extends JWindow {
	private static final long serialVersionUID = 1L;
	private ImageIcon image_icon;
	private Dimension dimension;

	public SplashScreen(long time) {
		this.setImageIcon(new ImageIcon("image\\splash_screen.png"));
		this.setDimension(new Dimension(image_icon.getIconWidth(), image_icon
				.getIconHeight()));
		this.setPreferredSize(dimension);

		this.pack();
		this.setLocationRelativeTo(null);
		this.setVisible(true);

		try {
			Thread.sleep(time);
		} catch (InterruptedException e) {
			e.printStackTrace();
		} finally {
			this.dispose();
		}
	}

	public void paint(Graphics graphics) {
		graphics.drawImage(this.image_icon.getImage(), 0, 0, this);
	}

	public ImageIcon getImageIcon() {
		return image_icon;
	}

	public void setImageIcon(ImageIcon image) {
		this.image_icon = image;
	}

	public Dimension getDimension() {
		return dimension;
	}

	public void setDimension(Dimension dimension) {
		this.dimension = dimension;
	}
}